mod server;

pub use server::*;
use tokio::sync::mpsc;

use crate::app::{FileProcessResult, P2pCommand, store};

#[derive(Debug)]
pub struct DfsGrpcService<FileStore>
where
    FileStore: store::Store + Send + Sync + 'static,
{
    file_publish_sender: mpsc::Sender<FileProcessResult>,
    p2p_command_sender: mpsc::Sender<P2pCommand>,
    file_store: FileStore,
}

impl<FileStore> DfsGrpcService<FileStore>
where
    FileStore: store::Store + Send + Sync + 'static,
{
    pub fn new(
        file_publish_sender: mpsc::Sender<FileProcessResult>,
        p2p_command_sender: mpsc::Sender<P2pCommand>,
        file_store: FileStore,
    ) -> Self {
        Self {
            file_publish_sender,
            p2p_command_sender,
            file_store,
        }
    }
}
